#include<iostream>
using namespace std;
int main()
{
    __int64 arr[50] = { 0 };
	int n;
	arr[1] = 3;
	arr[2] = 8;	
	for (int i = 3; i < 41; i++)
	{
		arr[i] = (arr[i - 2] + arr[i - 1]) * 2;
	}
	while (cin >> n && n)
	{
		cout << arr[n] << endl;
	}
	return 0;
}